﻿@using System.Collections
@using ExampleWebApplication.Controllers
@using ExampleWebApplication.Models
@using ExampleWebApplication.Properties
<h2>
    @NHibernateStrings.Example2
</h2>
<h3>
    <a target="_blank" href="http://demos.telerik.com/aspnet-mvc/razor/grid/serverbinding">
        Telerik demo version</a>
</h3>
@(Html.Telerik().Grid<ProductModel>()
        .Name("Grid")
        .BindTo((IEnumerable)ViewBag.Data)
        .Columns(columns =>
        {
            columns.Bound(d => d.ProductID).Width(80);
            columns.Bound(d => d.ProductName);
            columns.Bound(d => d.QuantityPerUnit);
            columns.Bound(d => d.Category.CategoryName).Title("Category");
        })
        .DataBinding(dataBinding => dataBinding.Server().Select<NHibernateController>(ctr => ctr.CustomServerBinding(null)))
        .Pageable(settings => settings.Total((int)ViewBag.Total).PageSize(15)/* We have to inform the pageSize here too!*/)
        .EnableCustomBinding(true)
        .Sortable()
        .Filterable()
        .Groupable()
)